package com.gxa.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gxa.common.LayR;
import com.gxa.mapper.CustomerConsumeMapper;
import com.gxa.param.MyTableParam;

import com.gxa.pojo.Consume;
import com.gxa.service.CustomerConsumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(rollbackFor = Throwable.class)
public class CustomerConsumeServiceImpl  implements CustomerConsumeService {
    @Autowired
    private CustomerConsumeMapper customerConsumeMapper;
    @Override
    public LayR list(MyTableParam param) {
        PageHelper.startPage(param.getPage(),param.getLimit());
        List<Consume>consumes =customerConsumeMapper.findAll(param);
        PageInfo<Consume> consumePageInfo = new PageInfo<>(consumes);
        return new LayR(0,"success",consumePageInfo.getList(),consumePageInfo.getTotal());
    }
}
